unit stats;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, DBGrids, DB, ZAbstractRODataset, ZAbstractDataset,
  ZDataset, Menus;

type
  TFStats = class(TForm)
    DataSource1: TDataSource;
    ZQuery1: TZQuery;
    DBGrid1: TDBGrid;
    PopupMenu1: TPopupMenu;
    N1: TMenuItem;
    N2: TMenuItem;
    procedure FormActivate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure N1Click(Sender: TObject);
    procedure N2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FStats: TFStats;

implementation

uses
  data;

{$R *.dfm}

procedure TFStats.FormActivate(Sender: TObject);
begin
  with ZQuery1 do begin
    sql.Clear;
    sql.Add('select * from stats order by s_l_key');
    open;
  end;
  DBGrid1.Columns[0].FieldName := 's_l_key';
  DBGrid1.Columns[1].FieldName := 's_name';
end;

procedure TFStats.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  DataSource1.DataSet.Edit;
  DataSource1.DataSet.Post;
  ZQuery1.Close;
  Action := caFree;
end;

procedure TFStats.N1Click(Sender: TObject);
begin
  DataSource1.DataSet.Append;
  DataSource1.DataSet.Post;
end;

procedure TFStats.N2Click(Sender: TObject);
begin
  DataSource1.DataSet.Delete;
end;

end.
